package script.reciteWord.items
{
	import laya.events.Event;
	
	import model.reciteWord.ReciteDateVo;
	import model.reciteWord.ReciteWordVo;
	
	import script.ViewManager;
	
	import ui.learn.item.ReciteDateItemUI;
	
	public class ReciteDateCell extends ReciteDateItemUI
	{
		private var reciteDateVo:ReciteDateVo;
		public function ReciteDateCell()
		{
			super();
			this.on(Event.CLICK,this,function(){
				ViewManager.instance.openView(ViewManager.VIEW_ADD_RECITE_WORD_PANEL,false,reciteDateVo);
			});
		}
		
		public function setData(data:ReciteDateVo):void
		{
			reciteDateVo = data;
			this.dateTxt.text = reciteDateVo.createTime.split(" ")[0];
			this.count.text = reciteDateVo.words.length + "";
			if(reciteDateVo.words.length > 0)
			{
				var temp:String = "";
				for(var i=0;i < reciteDateVo.words.length;i++)
				{
					if(i < 4)
					temp+=(reciteDateVo.words[i] as ReciteWordVo).word + ",";
				}
				this.comment.text = temp;
			}
			else
				this.comment.text = "";
		}
	}
}